package com.sandberg.shopper;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;

public class ShopperAboutActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		setContentView(R.layout.about);
		setVersionString();
    }

    private void setVersionString() {
		String formatted = getResources().getString(R.string.about_version);
		
		final int major = getResources().getInteger(R.integer.version_major);
		final int minor = getResources().getInteger(R.integer.version_minor);
		final int revision = getResources().getInteger(R.integer.version_revision);
		final String versionString = String.valueOf(major) + "." + String.valueOf(minor) + "." + String.valueOf(revision);
		formatted = String.format(formatted, versionString);
		
		TextView version = (TextView) findViewById(R.id.textAboutVersion);
		version.setText(formatted);
    }
/*
    public void onBuyFullVersion(View view) {
    	Intent intent = new Intent(Intent.ACTION_VIEW);
    	intent.setData(Uri.parse(getResources().getString(R.string.android_link)));
    	startActivity(intent);
    }
*/
    /* (non-Javadoc)
	 * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu)
	 */
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		
		menu.add(getResources().getString(R.string.option_menu_options))
			.setIcon(android.R.drawable.ic_menu_preferences)
			.setIntent(new Intent(this, ShopperSettingsActivity.class));

		menu.add(getResources().getString(R.string.option_menu_help))
			.setIcon(android.R.drawable.ic_menu_help)
			.setIntent(new Intent(this, ShopperSettingsActivity.class));

		return true;
	}
}